<html>
<head>
<link rel="stylesheet" type="text/css" href=<?php echo base_url()."zy.css"; ?> />
<title>复诊病例</title>
<style type="text/css">
@import <?php echo '"'.base_url()."autocomplete.css".'"'; ?>; 
</style>
<?php
echo '<script language="javascript">';
echo 'var mybaseurl = "'.base_url().'";';
echo '</script>';
base_url()
?>
<script  type="text/javascript" src=<?php echo base_url()."zy.js"; ?> ></script>
<script type="text/javascript" src=<?php echo base_url()."jquery.js"; ?> ></script>
<script type="text/javascript" src=<?php echo base_url()."cal.js"; ?> ></script>
<LINK rel=stylesheet type=text/css href=<?php echo base_url()."calendar.css"; ?> >
<SCRIPT type=text/javascript> 
jQuery(document).ready(function () {
	$('input.one').simpleDatepicker({ startdate: '10/01/1949', enddate: '10/01/2100' });
});
</SCRIPT>
</head>
<body>
<center>
<?php
	$this->load->library('myphplib');
	myphplib::myheadlinks();
?>
<br />
<br />
<br />
<h1>复诊病例</h1>
<?php
$index = $row->index;
$url = base_url()."index.php/zy_caselist/secondcase2done/$index";
echo form_open_multipart($url, "name=\"caseform\" onsubmit=\"return check()\"");
?>

<?php
	echo '<table cols="100" border="1" width="800"';
	
	if (!$table_bgcolor || !strcmp($table_bgcolor, "none"))
	{
		echo ">\n";
	}
	else
	{
		echo "style=background-color:".$table_bgcolor.">\n";
	}
?>
  <tr>
    <td style="background-color:gray" width="80">姓名</td>
    <td>
    <?php
    	$url = base_url()."index.php?c=zy_search&m=dosearch&search_method=name&search_key=";
    	$url .= str_replace(chr(32),'&nbsp;',addslashes(htmlspecialchars($row->name)));
    	$url .= "&per_page=0";
    	echo "<a href=$url>";
    	echo str_replace(chr(32),'&nbsp;',addslashes(htmlspecialchars($row->name)));
    	echo " </a>";
    ?>
    </td>
    <td style="background-color:gray">性别</td><td><?php echo (!strcmp($row->sex, 'M') ? "男性" : "女性"); ?></td>
    <td style="background-color:gray">年龄</td><td><?php echo ($row->age < 0) ? ($row->age + 1000)."月" : $row->age."岁"; ?></td>
    <td style="background-color:gray">日期</td>
    <td>
    <?php
    	$url = base_url()."index.php?c=zy_search&m=dosearch&search_method=date&search_key=";
    	$url .= $row->date;
    	$url .= "&per_page=0";
    	echo "<a href=$url>";
    	echo $row->date;
    	echo " </a>";
    ?>
    </td>
  </tr>
	<tr>
	<td>联系电话</td>
	<td><?php echo str_replace(chr(32),'&nbsp;',addslashes(htmlspecialchars($row->phonenum))); ?></td>
	<td>住址</td>
	<td colspan="5"><?php echo nl2br(htmlentities($row->addr)); ?></td>
	</tr>
	<tr>
	<td>发病日期</td>
	<td colspan="7"><?php echo nl2br(htmlentities($row->attackdate)); ?></td>
	</tr>
  <tr height="100">
    <td>病史</td><td colspan="7"><?php echo nl2br(htmlentities($row->diag)); ?></td>
  </tr>
  <tr height="50">
    <td>处方</td><td colspan="7"><?php echo nl2br(htmlentities($row->prescribe)); ?></td>
  </tr>
  <tr height="50">
    <td>煎煮法</td><td colspan="7"><?php echo nl2br(htmlentities($row->usemethod)); ?></td>
  </tr>
  <tr height="50">
    <td>备注</td><td colspan="7"><?php echo nl2br(htmlentities($row->comment)); ?></td>
  </tr>
  <tr>
  <td>文件列表</td>
  <td colspan="7">
  <?php
  	$files = explode(";", $row->files);

  	for ($i = 0; $i < count($files); $i++)
  	{
  		if (!strcmp($files[$i], ""))
  		{
  			continue;	
  		}

  		$fileurl = base_url().$this->load->get_var('uploaddir')."/$files[$i]";
  		echo "<a href=$fileurl>$files[$i]</a>";
  		
  		if ($i + 1 < count($files))
  		{
  			echo "<br />";
  		}
  	}
  ?>
  </td>
  </tr>

	<tr>
	<td>现状:</td>
	<td colspan="7">
	<?php
	$ndata = array('name' => 'patient_diag', 'value' => "", 'cols' => '100%', 'rows' => '10');
	echo form_textarea($ndata);
	?>
	</td>
	</tr>
	<tr>
	<td>处方:</td>
	<td colspan="7">
	<?php
	$ndata = array('name' => 'patient_prescribe', 'value' => "", 'cols' => '100%', 'rows' => '7');
	echo form_textarea($ndata);
	?>
	</tr>
	<tr>
	<td>
	处方选择:
	</td>
	<td colspan="7">
	<div class="autoComplete" style="z-index:1"> <input id="seltip" name="prescribename" value="" autocomplete="off" /> <ul><li></li></ul> </div>
	<input type="button" value='确定' onclick="check_prescribe()">
	新处方<input type="checkbox" name="patient_newprescribe"/>
	</td>
	</td>
	</tr>
	<tr>
	<td>煎煮法:</td>
	<td colspan="7">
	<?php
	$ndata = array('name' => 'patient_usemethod', 'value' => "", 'cols' => '100%', 'rows' => '3');
	echo form_textarea($ndata);
	?>
	</tr>
	<tr>
	<td>备注:</td>
	<td colspan="7">
	<?php
	$ndata = array('name' => 'patient_comment', 'value' => "", 'cols' => '100%', 'rows' => '3');
	echo form_textarea($ndata);
	?>
	</tr>
	<tr>
	<td>文件列表</td>
	<td colspan="9">
	<?php
		$files = explode(";", $row->files);
	
		for ($i = 0; $i < count($files); $i++)
		{
			if (!strcmp($files[$i], ""))
			{
				continue;	
			}
	
			$fileurl = base_url().$this->load->get_var('uploaddir')."/$files[$i]";
			echo "<a href=$fileurl>$files[$i]</a>";
	
			$delurl = base_url()."index.php?c=zy_caselist&m=deletefile&id=$row->index&file=$files[$i]";;
			echo "&nbsp;&nbsp;&nbsp;<a href=$delurl>删除</a>";
			
			if ($i + 1 < count($files))
			{
				echo "<br />";
			}
		}
	?>
	</td>
	</tr>
	<tr>
	<td>上传文件</td>
	<td colspan="7">
	<input id="input1" type="file" name="patient_file1" onchange="return HandleFileNameChange(1)"><br />
	<input id="input2" type="file" name="patient_file2" onchange="return HandleFileNameChange(2)"><br />
	<input id="input3" type="file" name="patient_file3" onchange="return HandleFileNameChange(3)"><br />
	<input id="input4" type="file" name="patient_file4" onchange="return HandleFileNameChange(4)"><br />
	<input id="input5" type="file" name="patient_file5" onchange="return HandleFileNameChange(5)">
	</td>
	</tr>
	<td></td>
	</tr>
	<tr>
	<td colspan="8" align="center"><input type="submit" value="提交" style="font-size: 15px" /></td>
	</tr>
</table>
</form>

</center>
</body>
</html>